package zzxkj.blog.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import zzxkj.blog.dto.DetailedBlog;
import zzxkj.blog.pojo.Blog;
import zzxkj.blog.service.BlogService;

import java.util.List;
import java.util.Map;

/**
 * @author zzxkj
 */
@Controller
public class ArchiveShowController {
    private final BlogService blogService;

    public ArchiveShowController(BlogService blogService) {
        this.blogService = blogService;
    }

    @GetMapping("/archives")
    public String archives(Model model) {
        model.addAttribute("archiveMap", blogService.archiveBlog());
        model.addAttribute("blogCount", blogService.countBlog());
        return "archives";
    }
}
